//个人中心头部用户信息
'use strict';
import React,{Component} from 'react';
import Header from '../common/header';
import styles from '../style/styles';
import Icon from 'react-native-vector-icons';
import AccountManager from './userManager';//账户管理
import NotifyInfo from './notifyInfo';//通知消息
import Util from '../common/util'
import {
    View,
    Text,
    Image,
    TouchableOpacity,
    Animated
} from 'react-native';

export default class userInfo extends Component {
    // 构造
    constructor(props) {
        super(props);
        // 初始状态
        this.state = {};
    }


    linkJump(name, user_id) {
        let that = this;
        that.props.navigator.push({
            component: name,
            passProps: {
                user_id: user_id,
            }
        })
    }

    render() {
        let datas = this.props.datas;
        let data = datas.data;
        let user_id = datas.user_id;
        let user_info = data.user_info;
        //LOG('头像===' + JSON.stringify(user_info.portrait))
        return (
            <View style={{marginBottom:10,height:200}}>
                <Image
                    resizeMode="stretch"
                    style={{height:200,width:Util.size.width}}
                    source={require('../imgs/userinfobg.jpg')}>
                    <View style={styles.userheader_wrap}>
                        <View style={styles.user_info}>
                            <TouchableOpacity onPress={()=>this.linkJump(AccountManager,user_id)}>
                                {user_info.portrait == '' ?
                                    <View style={styles.user_logo}>
                                        <Image
                                            resizeMode="cover"
                                            style={styles.user_logo1}
                                            source={require('../imgs/user.png')}/>
                                    </View>
                                    :
                                    <View style={styles.user_logo}>
                                        <Image
                                            resizeMode="cover"
                                            style={styles.user_logo1}
                                            source={{uri:user_info.portrait}}/>
                                    </View>
                                }

                            </TouchableOpacity>
                            <View style={{justifyContent:'center',alignItems:'center'}}>
                                {user_info.real_name == '' ?
                                    <Text style={styles.user_name1}>{user_info.user_name}</Text>
                                    :
                                    <Text style={styles.user_name1}>{user_info.real_name}</Text>
                                }

                            </View>
                        </View>
                    </View>
                </Image>
            </View>
        )
    }
}